<?php

class SourceDocumentTagsController extends AppController {

    public $scaffold;
    
    public $components = array(
        'ExtendedScaffold.ScaffoldUtil' => array(
            'addUnsetFields' => array(
                'complete'
            )
        )
    );
    public $notModuleActions = array(
        'edit',
    );
    public $moduleActions = array(
        array(
            'url' => array('action' => 'complete_raw_file_tags'),
            'hasId' => true,
            'format' => 'Complete Raw File Tags',
        ),
    );

    public function complete_raw_file_tags($id) {
        $sourceDocumentTag = $this->SourceDocumentTag->findById($id);
        $this->flash(
                $this->SourceDocumentTag->complete($sourceDocumentTag) ?
                        'Source document completed.' :
                        'Failed to complete Source document.'
                , '/source_document_tags'
        );
    }

    public function _isNavigableCompleteRawFileTags($params) {
        $sourceDocumentTag = $this->SourceDocumentTag->findById($params['targetActionUrl']['id']);
        return !$sourceDocumentTag['SourceDocumentTag']['complete'];
    }

}
